<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Define or return the exit mode for the current running service</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.win32-set-service-exit-code.html">« win32_set_service_exit_code</a></li>
      <li style="float: right;"><a href="function.win32-set-service-status.html">win32_set_service_status »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.win32service.html">win32service 函数</a></li>
    <li>Define or return the exit mode for the current running service</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.win32-set-service-exit-mode" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">win32_set_service_exit_mode</h1>
  <p class="verinfo">(PECL win32service &gt;=0.4.0)</p><p class="refpurpose"><span class="refname">win32_set_service_exit_mode</span> &mdash; <span class="dc-title">Define or return the exit mode for the current running service</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.win32-set-service-exit-mode-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>win32_set_service_exit_mode</strong></span>(<span class="methodparam"><span class="type">bool</span> <code class="parameter">$gracefulMode</code><span class="initializer"> = true</span></span>): <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   If <code class="parameter">gracefulMode</code> parameter is provided, the exit mode 
is changed. When the exit mode is not gracefuly, the exit code used can be set 
with the <span class="function"><a href="function.win32-set-service-exit-code.html" class="function">win32_set_service_exit_code()</a></span> function.
  </p>
  
  <div class="caution"><strong class="caution">警告</strong>
   <p class="para">
    This function work only in &quot;cli&quot; SAPI. On other SAPI 
    this function is disabled.
   </p>
  </div>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.win32-set-service-exit-mode-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt>
<code class="parameter">gracefulMode</code></dt>

    <dd>

     <p class="para">
      <strong><code>true</code></strong> for exit graceful. <strong><code>false</code></strong> for exit with error.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.win32-set-service-exit-mode-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Return the current or old exit mode.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.win32-set-service-exit-mode-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
   Prior to version 1.0.0, if the SAPI is not <code class="literal">&quot;cli&quot;</code>, this function emits an
   <strong><code>E_ERROR</code></strong> level error.
  </p>

   <p class="para">
    As of version 1.0.0, will throw a 
    <span class="classname"><a href="class.win32serviceexception.html" class="classname">Win32ServiceException</a></span> if SAPI is not 
    <code class="literal">&quot;cli&quot;</code>
   </p>
 </div>



 <div class="refsect1 changelog" id="refsect1-function.win32-set-service-exit-mode-changelog">
  <h3 class="title">更新日志</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>版本</th>
       <th>说明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>PECL win32service 1.0.0</td>
       <td>
        Throws a <span class="classname"><a href="class.valueerror.html" class="classname">ValueError</a></span> on invalid data in parameters,
        previously <strong><code>false</code></strong> was returned.
       </td>
      </tr>

      <tr>
       <td>PECL win32service 1.0.0</td>
       <td>
        Throws a <span class="classname"><a href="class.win32serviceexception.html" class="classname">Win32ServiceException</a></span> on error,
        previously a 
        <a href="win32service.constants.errors.html" class="link">Win32 Error Code</a>
        was returned.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.win32-set-service-exit-mode-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.win32-start-service-ctrl-dispatcher.html" class="function" rel="rdfs-seeAlso">win32_start_service_ctrl_dispatcher()</a> - Registers the script with the SCM, so that it can act as the service with the given name</span></li>
    <li class="member"><span class="function"><a href="function.win32-set-service-status.html" class="function" rel="rdfs-seeAlso">win32_set_service_status()</a> - Update the service status</span></li>
    <li class="member"><span class="function"><a href="function.win32-set-service-exit-code.html" class="function" rel="rdfs-seeAlso">win32_set_service_exit_code()</a> - Define or return the exit code for the current running service</span></li>
  </ul>
 </div>


</div></div></div></body></html>